package cn.caplike.demo.netty.http.quickstart;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.http.HttpServerCodec;

/**
 * Description:
 *
 * @author LiKe
 * @version 1.0.0
 * @date 2021-11-26 17:42
 */
public class TestServerChannelInitializer extends ChannelInitializer<SocketChannel> {

    @Override
    protected void initChannel(SocketChannel ch) {
        ChannelPipeline pipeline = ch.pipeline();

        pipeline.addLast("httpServerCodec", new HttpServerCodec()); // 对请求和响应进行编解码
        pipeline.addLast("testHttpServerHandler", new TestHttpServerChannelInboundHandler());
    }

}
